home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pbmpl91d.zip / PBMPLUS / MAN / LIBPPM.MAN < prev    next >
Text File  |  1993-01-08  |  6KB  |  213 lines

  1.  
  2.  
  3. libppm(3)                  Unix Programmer's Manual                  libppm(3)
  4.  
  5.  
  6. NAME
  7.      libppm - functions to support portable pixmap programs
  8.  
  9. SYNOPSIS
  10.  
  11.      #include <ppm.h>
  12.      cc ... libppm.a libpgm.a libpbm.a
  13.  
  14.  
  15. DESCRIPTION
  16.  
  17.      TYPES AND CONSTANTS
  18.  
  19.      typedef ... pixel;
  20.      typedef ... pixval;
  21.      #define PPM_MAXMAXVAL ...
  22.      extern pixval ppm_pbmmaxval;
  23.  
  24.      Each pixel contains three pixvals, each of which should contain only  the
  25.      values  between  0  and  PPM_MAXMAXVAL.  ppm_pbmmaxval is the maxval used
  26.                                  -               -
  27.      when a PPM program reads a PBM file.  Normally it is 1; however, for some
  28.      programs, a larger value gives better results.
  29.  
  30.      #define PPM_FORMAT ...
  31.      #define RPPM_FORMAT ...
  32.      #define PPM_TYPE PPM_FORMAT
  33.      int PPM_FORMAT_TYPE( int format )
  34.  
  35.      For distinguishing different file formats and types.
  36.  
  37.      pixval PPM_GETR( pixel p )
  38.                -
  39.      pixval PPM_GETG( pixel p )
  40.                -
  41.      pixval PPM_GETB( pixel p )
  42.                -
  43.  
  44.      These three macros retrieve the red, green or blue value from  the  given
  45.      pixel.
  46.  
  47.      void PPM_ASSIGN( pixel p, pixval red, pixval grn, pixval blu )
  48.              -
  49.  
  50.      This macro assigns the given red, green and blue values to the pixel.
  51.  
  52.      int PPM_EQUAL( pixel p, pixel q )
  53.             -
  54.  
  55.      This macro checks two pixels for equality.
  56.  
  57.      void PPM_DEPTH( pixel newp, pixel p, pixval oldmaxval, pixval newmaxval )
  58.              -
  59.  
  60.      This macro scales the colors of pixel p according the old and new maximum
  61.      values  and  assigns  the  new  values  to  newp.  It is intended to make
  62.      writing ppmtowhatever easier.
  63.  
  64.      float PPM_LUMIN( pixel p )
  65.  
  66.      This macro determines the luminance of the pixel p.
  67.  
  68.  
  69.  
  70.  
  71.                                                                              1
  72.  
  73.  
  74.  
  75. libppm(3)                  Unix Programmer's Manual                  libppm(3)
  76.  
  77.  
  78.      MEMORY MANAGEMENT
  79.  
  80.      pixel** ppm_allocarray( int cols, int rows )
  81.  
  82.      Allocate an array of pixels.
  83.  
  84.      pixel* ppm_allocrow( int cols )
  85.                -
  86.  
  87.      Allocate a row of the given number of pixels.
  88.  
  89.      void ppm_freearray( pixel** pixels, int rows )
  90.              -
  91.  
  92.      Free the array  allocated  with  ppm_allocarray()  containing  the  given
  93.                                          -
  94.      number of rows.
  95.  
  96.      void pbm_freerow( pixel* pixelrow )
  97.  
  98.      Free a row of pixels.
  99.  
  100.      READING PBM FILES
  101.  
  102.      void ppm_readppminit( FILE* fp, int* colsP, int* rowsP, pixval*  maxvalP,
  103.      int* formatP )
  104.  
  105.      Read the header from a PPM file, filling in the rows,  cols,  maxval  and
  106.      format variables.
  107.  
  108.      void ppm_readppmrow( FILE* fp, pixel* pixelrow, int cols, pixval  maxval,
  109.              -
  110.      int format )
  111.  
  112.      Read a row of pixels into the pixelrow array.  Format, cols,  and  maxval
  113.      were filled in by ppm_readppminit().
  114.                           -
  115.  
  116.      pixel** ppm_readppm( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP )
  117.  
  118.      Read an entire pixmap file into memory, returning the allocated array and
  119.      filling  in  the rows, cols and maxval variables.  This function combines
  120.      ppm_readppminit(), ppm_allocarray() and ppm_readppmrow().
  121.         -                  -                    -
  122.  
  123.      WRITING FILES
  124.  
  125.      void ppm_writeppminit( FILE* fp, int cols, int rows, pixval  maxval,  int
  126.      forceplain )
  127.  
  128.      Write the header for a portable pixmap file.  The forceplain flag  forces
  129.      a plain-format file to be written, as opposed to a raw-format one.
  130.  
  131.      void ppm_writeppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval,
  132.              -
  133.      int forceplain )
  134.  
  135.      Write a row from a portable pixmap.
  136.  
  137.      void ppm_writeppm( FILE* fp, pixel** pixels, int cols, int  rows,  pixval
  138.              -
  139.      maxval, int forceplain )
  140.  
  141.      Write the header and all data  for  a  portable  pixmap.   This  function
  142.  
  143.  
  144.                                                                              2
  145.  
  146.  
  147.  
  148. libppm(3)                  Unix Programmer's Manual                  libppm(3)
  149.  
  150.  
  151.      combines ppm_writeppminit() and ppm_writeppmrow().
  152.                  -                      -
  153.  
  154.      COLOR NAMES
  155.  
  156.      pixel ppm_parsecolor( char* colorname, pixval maxval )
  157.  
  158.      Parses an ASCII color name into a pixel.  The color can be  specified  in
  159.      three  ways.   One,  as  a  name, assuming that a pointer to an X11-style
  160.      color names file was compiled  in.   Two,  as  an  X11-style  hexadecimal
  161.      number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb.  Three, as a triplet
  162.      of decimal floating point numbers separated by commas: r.r,g.g,b.b.
  163.  
  164.      char* ppm_colorname( pixel* colorP, pixval maxval, int hexok )
  165.               -
  166.  
  167.      Returns a pointer to a string describing the given  color.   If  the  X11
  168.      color  names  file is available and the color appears in it, that name is
  169.      returned.  Otherwise, if the  hexok  flag  is  true  then  a  hexadecimal
  170.      colorspec  is returned; if hexok is false and the X11 color names file is
  171.      available, then the closest matching color is returned;  otherwise,  it's
  172.      an error.
  173.  
  174. SEE ALSO
  175.      pbm(3), pgm(3)
  176.  
  177. AUTHOR
  178.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.                                                                              3
  212.  
  213.